
#ifndef TORCH_H
#define TORCH_H
//#include <QGraphicsScene>
#include <QMainWindow>
#include<QTimer>
#include<QObject>
#include<QRandomGenerator>
#include<QGraphicsItem>
#include"map.h"
#include"playermove.h"
QT_BEGIN_NAMESPACE
namespace Ui { class Torch; }
QT_END_NAMESPACE

struct Block{
    QRect block;
    int size;
    int posi;
};

class Torch : public QMainWindow
{
    Q_OBJECT

public:
    Torch(QWidget *parent = nullptr);
    ~Torch();
    void paintEvent(QPaintEvent*event)override;
    void keyPressEvent(QKeyEvent*event)override;
    void begin();//初始化
    void becreat(Block&);//生成障碍
    void jump();
    void fall();
void picturemove();
    bool ishit();
//private slots:

private:
    void timerEvent(QTimerEvent*event)override;
    bool isstart;
    bool isover;
    Ui::Torch *ui;
    Map background;
    double score;
    int timer1;
    int timer2;


    QRect person;
    int pump;
    //Playermove player;
    //Node*tab;
    QVector<Block>blocks;
    bool isjump;
    int pnum1;
    int pnum2;
    int ten;
    int temn;//人跳跃下落次数//跃起后停留空中事件
    double lives;//生命值
    QVector<QRect>blood;
    int direction;//人的位置
    double gravitydown;//跳跃下落速度
    double gravityup;
    int num;
    int starts;
    int starty;
    //障碍物
    int *pos;//指向碰撞的障碍编号

};

#endif // TORCH_H
